#pragma once
#include "Runnable.h"
#include "XmlServer.h"
#include "ServerFullInformation.h"
#include "boost\thread.hpp"
#include "ServerCoordinator.h"
#include <list>
#include "PrezenterServer.h"
class XmlServer;
class Coordinator :
	public Runnable
{
public:
	 Coordinator(int port);
	 void run();
	 void startCoordinator();
	 void addServerInformation(const std::string& name,const ElectedRet& elected );
	 void stopCoordinator();
	 void addServerInformation(const ServerInfo & servInfo);
	 
	 AliveRet alive(const AliveMsg& msg );
	 TaskRegistrationRet registerTask(const TaskRegistration & taskReg);
	 NumberOfTasksRet getNumberOfTasks();
	 void changeTaskStatus(const TaskStatusChange & taskStatusChange);

	~Coordinator(void);
protected:
	XmlServer *xmlServer;
	boost::thread *xmlServerThread;
	boost::thread *coordinatorThread;
	std::list<ServerFullInformation> serverInfoList;
	std::list<Task> newTaskList;
	
};

